﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using IEMSOFT.EasyHotel.Admin.Models;
using IEMSOFT.Foundation.MVC;
namespace IEMSOFT.EasyHotel.Admin.Filters
{
    public class ExceptionFilterAttribute : FilterAttribute, IExceptionFilter
    {
        public   void  OnException (ExceptionContext filterContext)
        {
            var error = new BasicResult<string, List<string>>();
            error.Msg = new List<string>();
            error.Msg.Add(string.Format("系统内部发生错误！<br/>错误：{0}",filterContext.Exception.Message));
            var jsonResult=new JsonNetResult(error);
            filterContext.Result = jsonResult;
          //  filterContext.HttpContext.Response.StatusCode = 200;
            filterContext.ExceptionHandled = true;
        }
    }
}